<script setup>
import { defineProps, defineEmits } from 'vue'
const props = defineProps({
  title: {
    type: String
  },
  score: {
    type: Number
  },
  pingyu: {
    type: String
  },
  showretry: {
    type: Boolean,
    default: false
  },
  showdayin: {
    type: Boolean,
    default: false
  },
  titleclass: {
    type: String
  }
})
const emit = defineEmits(['chongxin-dati', 'close-chengji', 'chuangguan-chenggong'])
function retryDati() {
  emit('chongxin-dati')
}
function closeChengji() {
  emit('close-chengji')
}
function successAll(){
  emit('chuangguan-chenggong')
}
</script>

<template>
  <div class="jieguo_container">
    <div class="jieguo_bg juzhong">
      <div class="jieguo_title juzhong" :class="props.titleclass">{{ props.title }}</div>
      <div class="jieguo_fenshu juzhong">
        本次得分
        <span class="jiacu">{{ props.score }}分</span>
      </div>
      <div class="jieguo_pingyu juzhong">{{ props.pingyu }}</div>
      <div v-if="showretry" class="jieguo_anretry juzhong" @click="retryDati">再试一次</div>
      <div v-if="showdayin" class="jieguo_andayin juzhong" @click="successAll">打印荣誉证书</div>
      <div class="jieguo_an2main juzhong" @click="closeChengji">返回首页</div>
    </div>
  </div>
</template>
<style lang="scss" scoped>
.juzhong {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.style_success {
  color: #f6c61a;
}
.style_failure {
  color: #b4f7fe;
}
.jieguo_container {
  width: 100%;
  height: 100%;
  background-color: #00000099;
  position: relative;
  z-index: 1;
  .jieguo_bg {
    width: 40vw;
    height: 30vw;
    position: absolute;
    bottom: 10vh;
    background-color: #4588ed;
    border: 1px dashed white;
    z-index: 2;
  }
  .jieguo_title {
    font-size: 5rem;
    font-weight: bolder;
    letter-spacing: 2rem;
    position: absolute;
    top: -4vw;
  }
  .jieguo_fenshu {
    color: white;
    font-size: 2rem;
    letter-spacing: 0.5rem;
    position: absolute;
    top: 5vw;
    .jiacu {
      font-size: 2.4rem;
      font-weight: bolder;
    }
  }
  .jieguo_pingyu {
    width: fit-content;
    height: fit-content;
    padding: 0.4rem 6rem;
    background-color: #1f58ae;
    color: #fff000;
    font-size: 1.8rem;
    letter-spacing: 0.3rem;
    font-weight: bold;
    position: absolute;
    top: 10vw;
  }
  .jieguo_anretry {
    width: 15vw;
    height: 3.4vw;
    background-color: #ffd100;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    letter-spacing: 0.3rem;
    font-weight: bold;
    border-radius: 1rem;
    position: absolute;
    top: 16vw;
  }
  .jieguo_andayin {
    width: 15vw;
    height: 3.4vw;
    background-color: #ffd100;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    letter-spacing: 0.3rem;
    font-weight: bold;
    border-radius: 1rem;
    position: absolute;
    top: 16vw;
  }
  .jieguo_an2main {
    width: 15vw;
    height: 3.4vw;
    background-color: #c6cdda;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    letter-spacing: 0.3rem;
    font-weight: bold;
    border-radius: 1rem;
    position: absolute;
    top: 22vw;
  }
}
</style>
